package com.RedRiver.hospitalsystem.finance_service.client;

import com.RedRiver.hospitalsystem.finance_service.client.param.*;
import com.RedRiver.hospitalsystem.result.Result;
import com.alipay.api.AlipayApiException;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.UnsupportedEncodingException;

@FeignClient(contextId = "BillClient",name="finance-service",path="financeService/bill")
public interface BillClient {

    @GetMapping("moniYibao")
    String moniYibao(@ApiParam("请输入账单id") @RequestParam("id")Integer id);

    @PostMapping("/createBill")
    Result<FindBillAllInfoClient> createBill(@RequestBody @Valid CreateBillFromClient createBillFromClient);
    @PostMapping("/findBillAll")
    Result<FindBillAllListInfoClient> findBillAll(@RequestBody @Valid FindBillAllFormClient findBillAllFormClient);
    @GetMapping("/findBillById")
    Result<FindBillAllInfoClient> findBillById(@RequestParam("id") Integer id);
    @PostMapping("/changeBillById")
    Result<FindBillAllInfoClient> changeBillById(@RequestBody ChangeBillByIdFromClient changeBillByIdFromClient);
    @GetMapping("/findBillByCheckId")
    Result<FindBillAllInfoClient> findBillByCheckId(@RequestParam("id")Integer id);

    @GetMapping("aliPay")
    String aliPay(@ApiParam("请输入账单id") @RequestParam("id")Integer id)throws AlipayApiException;
    @GetMapping("returnUrl")   //不做订单相关的事  页面跳转
    Result<FindBillAllInfoClient> returnUrl() throws UnsupportedEncodingException;
    @PostMapping("notyfyUrl")
    void notyfyUrl() throws UnsupportedEncodingException;
    @GetMapping("notOrder")
    Result<String> notOrder(@ApiParam("请输入账单id") @RequestParam("id")Integer id);
    @GetMapping("notYesOrder")
    Result<String> notYesOrder(@ApiParam("请输入账单id") @RequestParam("id")Integer id)  throws Exception;
    @PostMapping("/toRefund")
    String toRefund(@RequestBody RefundFromClient refundFromClient) throws Exception;
    }
